import Util;
import RPCUtil;
import RPC;
import EndpointUtil;

extends RPC;

init(config: RPC.Config){
  super(config);
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('emas-devops', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

model ListPipelineDefinitionsRequest = {
  appKey?: string(name='AppKey'),
  pipelineScope?: string(name='PipelineScope'),
  source?: string(name='Source'),
  pageSize: integer(name='PageSize'),
  pageNumber: integer(name='PageNumber'),
}

model ListPipelineDefinitionsResponse = {
  requestId: string(name='RequestId'),
  pageNum: integer(name='PageNum'),
  pageSize: integer(name='PageSize'),
  total: integer(name='Total'),
  items: [
    {
      bid: string(name='Bid'),
      name: string(name='Name'),
      description: string(name='Description'),
      appKey: string(name='AppKey'),
      version: string(name='Version'),
      type: string(name='Type'),
      source: string(name='Source'),
      status: string(name='Status'),
      creator: string(name='Creator'),
      modifier: string(name='Modifier'),
      createTime: long(name='CreateTime'),
      updateTime: long(name='UpdateTime'),
    }
  ](name='Items'),
}

async function listPipelineDefinitionsWithOptions(request: ListPipelineDefinitionsRequest, runtime: Util.RuntimeOptions): ListPipelineDefinitionsResponse {
  Util.validateModel(request);
  return doRequest('ListPipelineDefinitions', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function listPipelineDefinitions(request: ListPipelineDefinitionsRequest): ListPipelineDefinitionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPipelineDefinitionsWithOptions(request, runtime);
}

model DescribePublishRecommendVersionRequest = {
  appKey: string(name='AppKey'),
  appPlatform: integer(name='AppPlatform'),
}

model DescribePublishRecommendVersionResponse = {
  requestId: string(name='RequestId'),
  latestVersion: string(name='LatestVersion'),
  recommendVersion: string(name='RecommendVersion'),
  latestVersionCode: integer(name='LatestVersionCode'),
  recommendVersionCode: integer(name='RecommendVersionCode'),
}

async function describePublishRecommendVersionWithOptions(request: DescribePublishRecommendVersionRequest, runtime: Util.RuntimeOptions): DescribePublishRecommendVersionResponse {
  Util.validateModel(request);
  return doRequest('DescribePublishRecommendVersion', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function describePublishRecommendVersion(request: DescribePublishRecommendVersionRequest): DescribePublishRecommendVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return describePublishRecommendVersionWithOptions(request, runtime);
}

model ListPipelineInstancesByAppKeyRequest = {
  pipelineType: string(name='PipelineType'),
  appKey: string(name='AppKey'),
  pageSize: integer(name='PageSize'),
  pageNumber: integer(name='PageNumber'),
}

model ListPipelineInstancesByAppKeyResponse = {
  requestId: string(name='RequestId'),
  pageNum: integer(name='PageNum'),
  pageSize: integer(name='PageSize'),
  total: integer(name='Total'),
  items: [
    {
      pipelineInstanceId: string(name='PipelineInstanceId'),
      pipelineDefinitionName: string(name='PipelineDefinitionName'),
      pipelineDefinitionId: string(name='PipelineDefinitionId'),
      createTime: long(name='CreateTime'),
      updateTime: long(name='UpdateTime'),
      startTime: long(name='StartTime'),
      endTime: long(name='EndTime'),
      operator: string(name='Operator'),
      status: string(name='Status'),
      pipelineArtifacts: [
        {
          fileKey: string(name='FileKey'),
          fileName: string(name='FileName'),
          fileType: string(name='FileType'),
          fileUrl: string(name='FileUrl'),
          storageType: string(name='StorageType'),
          isPublic: boolean(name='IsPublic'),
          size: long(name='Size'),
          md5: string(name='Md5'),
          jobInstanceId: string(name='JobInstanceId'),
          createTime: long(name='CreateTime'),
          updateTime: long(name='UpdateTime'),
          ext: string(name='Ext'),
        }
      ](name='PipelineArtifacts'),
    }
  ](name='Items'),
}

async function listPipelineInstancesByAppKeyWithOptions(request: ListPipelineInstancesByAppKeyRequest, runtime: Util.RuntimeOptions): ListPipelineInstancesByAppKeyResponse {
  Util.validateModel(request);
  return doRequest('ListPipelineInstancesByAppKey', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function listPipelineInstancesByAppKey(request: ListPipelineInstancesByAppKeyRequest): ListPipelineInstancesByAppKeyResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPipelineInstancesByAppKeyWithOptions(request, runtime);
}

model ListPipelineInstancesByDefinitionRequest = {
  pipelineDefinitionId: string(name='PipelineDefinitionId'),
  pageSize: integer(name='PageSize'),
  pageNumber: integer(name='PageNumber'),
}

model ListPipelineInstancesByDefinitionResponse = {
  requestId: string(name='RequestId'),
  pageNum: integer(name='PageNum'),
  pageSize: integer(name='PageSize'),
  total: integer(name='Total'),
  items: [
    {
      pipelineInstanceId: string(name='PipelineInstanceId'),
      pipelineDefinitionName: string(name='PipelineDefinitionName'),
      pipelineDefinitionId: string(name='PipelineDefinitionId'),
      createTime: long(name='CreateTime'),
      updateTime: long(name='UpdateTime'),
      startTime: long(name='StartTime'),
      endTime: long(name='EndTime'),
      operator: string(name='Operator'),
      status: string(name='Status'),
      pipelineArtifacts: [
        {
          fileKey: string(name='FileKey'),
          fileName: string(name='FileName'),
          fileType: string(name='FileType'),
          fileUrl: string(name='FileUrl'),
          storageType: string(name='StorageType'),
          artifactType: string(name='ArtifactType'),
          isPublic: boolean(name='IsPublic'),
          size: long(name='Size'),
          md5: string(name='Md5'),
          jobInstanceId: string(name='JobInstanceId'),
          createTime: long(name='CreateTime'),
          updateTime: long(name='UpdateTime'),
          ext: string(name='Ext'),
        }
      ](name='PipelineArtifacts'),
    }
  ](name='Items'),
}

async function listPipelineInstancesByDefinitionWithOptions(request: ListPipelineInstancesByDefinitionRequest, runtime: Util.RuntimeOptions): ListPipelineInstancesByDefinitionResponse {
  Util.validateModel(request);
  return doRequest('ListPipelineInstancesByDefinition', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function listPipelineInstancesByDefinition(request: ListPipelineInstancesByDefinitionRequest): ListPipelineInstancesByDefinitionResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPipelineInstancesByDefinitionWithOptions(request, runtime);
}

model ListPublishPlansRequest = {
  appKey?: string(name='AppKey'),
  publishVersion?: string(name='PublishVersion'),
  planStatus?: string(name='PlanStatus'),
  pageNum: integer(name='PageNum'),
  pageSize: integer(name='PageSize'),
  appPlatform?: integer(name='AppPlatform'),
}

model ListPublishPlansResponse = {
  requestId: string(name='RequestId'),
  pageNum: integer(name='PageNum'),
  pageSize: integer(name='PageSize'),
  total: integer(name='Total'),
  items: [
    {
      publishPlanBid: string(name='PublishPlanBid'),
      pipelineId: string(name='PipelineId'),
      planName: string(name='PlanName'),
      appName: string(name='AppName'),
      version: string(name='Version'),
      planStatus: string(name='PlanStatus'),
      appKey: string(name='AppKey'),
      appPlatform: integer(name='AppPlatform'),
      createTime: long(name='CreateTime'),
      creatorAccount: {
        uid: string(name='Uid'),
        username: string(name='Username'),
        displayName: string(name='DisplayName'),
        email: string(name='Email'),
      }(name='CreatorAccount'),
    }
  ](name='Items'),
}

async function listPublishPlansWithOptions(request: ListPublishPlansRequest, runtime: Util.RuntimeOptions): ListPublishPlansResponse {
  Util.validateModel(request);
  return doRequest('ListPublishPlans', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function listPublishPlans(request: ListPublishPlansRequest): ListPublishPlansResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPublishPlansWithOptions(request, runtime);
}

model DescribePublishPlanDetailRequest = {
  appKey: string(name='AppKey'),
  planBid: string(name='PlanBid'),
}

model DescribePublishPlanDetailResponse = {
  requestId: string(name='RequestId'),
  publishPlanBid: string(name='PublishPlanBid'),
  pipelineId: string(name='PipelineId'),
  planName: string(name='PlanName'),
  appName: string(name='AppName'),
  version: string(name='Version'),
  planStatus: string(name='PlanStatus'),
  createTime: long(name='CreateTime'),
  creatorAccount: {
    uid: string(name='Uid'),
    username: string(name='Username'),
    displayName: string(name='DisplayName'),
    email: string(name='Email'),
  }(name='CreatorAccount'),
}

async function describePublishPlanDetailWithOptions(request: DescribePublishPlanDetailRequest, runtime: Util.RuntimeOptions): DescribePublishPlanDetailResponse {
  Util.validateModel(request);
  return doRequest('DescribePublishPlanDetail', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function describePublishPlanDetail(request: DescribePublishPlanDetailRequest): DescribePublishPlanDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return describePublishPlanDetailWithOptions(request, runtime);
}

model DescribePublishPlanDataRequest = {
  appKey: string(name='AppKey'),
  planBid: string(name='PlanBid'),
}

model DescribePublishPlanDataResponse = {
  requestId: string(name='RequestId'),
  updateData: {
    notifiedCount: long(name='NotifiedCount'),
    updatedCount: long(name='UpdatedCount'),
  }(name='UpdateData'),
}

async function describePublishPlanDataWithOptions(request: DescribePublishPlanDataRequest, runtime: Util.RuntimeOptions): DescribePublishPlanDataResponse {
  Util.validateModel(request);
  return doRequest('DescribePublishPlanData', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function describePublishPlanData(request: DescribePublishPlanDataRequest): DescribePublishPlanDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return describePublishPlanDataWithOptions(request, runtime);
}

model ModifyPipelineDefinitionDslRequest = {
  bid: string(name='Bid'),
  nodePath: string(name='NodePath'),
  nodeValue: string(name='NodeValue'),
}

model ModifyPipelineDefinitionDslResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function modifyPipelineDefinitionDslWithOptions(request: ModifyPipelineDefinitionDslRequest, runtime: Util.RuntimeOptions): ModifyPipelineDefinitionDslResponse {
  Util.validateModel(request);
  return doRequest('ModifyPipelineDefinitionDsl', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function modifyPipelineDefinitionDsl(request: ModifyPipelineDefinitionDslRequest): ModifyPipelineDefinitionDslResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPipelineDefinitionDslWithOptions(request, runtime);
}

model DescribePipelineJobInstanceDetailRequest = {
  jobInstanceId: string(name='JobInstanceId'),
}

model DescribePipelineJobInstanceDetailResponse = {
  requestId: string(name='RequestId'),
  status: string(name='Status'),
  stepDetails: [
    {
      name: string(name='Name'),
      bid: string(name='Bid'),
      jobInstanceId: string(name='JobInstanceId'),
      status: string(name='Status'),
      createTime: long(name='CreateTime'),
      updateTime: long(name='UpdateTime'),
      startTime: long(name='StartTime'),
      endTime: long(name='EndTime'),
      logFileUrl: string(name='LogFileUrl'),
    }
  ](name='StepDetails'),
}

async function describePipelineJobInstanceDetailWithOptions(request: DescribePipelineJobInstanceDetailRequest, runtime: Util.RuntimeOptions): DescribePipelineJobInstanceDetailResponse {
  Util.validateModel(request);
  return doRequest('DescribePipelineJobInstanceDetail', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function describePipelineJobInstanceDetail(request: DescribePipelineJobInstanceDetailRequest): DescribePipelineJobInstanceDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return describePipelineJobInstanceDetailWithOptions(request, runtime);
}

model ModifyPipelineEnvVariablesRequest = {
  bid: string(name='Bid'),
  envVariables: string(name='EnvVariables'),
}

model ModifyPipelineEnvVariablesResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function modifyPipelineEnvVariablesWithOptions(request: ModifyPipelineEnvVariablesRequest, runtime: Util.RuntimeOptions): ModifyPipelineEnvVariablesResponse {
  Util.validateModel(request);
  return doRequest('ModifyPipelineEnvVariables', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function modifyPipelineEnvVariables(request: ModifyPipelineEnvVariablesRequest): ModifyPipelineEnvVariablesResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPipelineEnvVariablesWithOptions(request, runtime);
}

model TriggerPipelineRequest = {
  pipelineId: string(name='PipelineId'),
  runtimeEnvVariables?: map[string]any(name='RuntimeEnvVariables'),
}

model TriggerPipelineShrinkRequest = {
  pipelineId: string(name='PipelineId'),
  runtimeEnvVariablesShrink?: string(name='RuntimeEnvVariables'),
}

model TriggerPipelineResponse = {
  requestId: string(name='RequestId'),
  result: string(name='Result'),
}

async function triggerPipelineWithOptions(tmp: TriggerPipelineRequest, runtime: Util.RuntimeOptions): TriggerPipelineResponse {
  Util.validateModel(tmp);
  var request = new TriggerPipelineShrinkRequest{};
  RPCUtil.convert(tmp, request);
  if (!Util.isUnset(tmp.runtimeEnvVariables)) {
    request.runtimeEnvVariablesShrink = Util.toJSONString(tmp.runtimeEnvVariables);
  }

  return doRequest('TriggerPipeline', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function triggerPipeline(request: TriggerPipelineRequest): TriggerPipelineResponse {
  var runtime = new Util.RuntimeOptions{};
  return triggerPipelineWithOptions(request, runtime);
}

model ListPipelineTemplatesRequest = {
  appKey?: string(name='AppKey'),
  appPlatform?: integer(name='AppPlatform'),
  pipelineScope?: string(name='PipelineScope'),
  pipelineLevel?: string(name='PipelineLevel'),
}

model ListPipelineTemplatesResponse = {
  requestId: string(name='RequestId'),
  items: [
    {
      bid: string(name='Bid'),
      appKey: string(name='AppKey'),
      type: string(name='Type'),
      category: string(name='Category'),
      createTime: long(name='CreateTime'),
      updateTime: long(name='UpdateTime'),
      creator: string(name='Creator'),
      modifier: string(name='Modifier'),
    }
  ](name='Items'),
}

async function listPipelineTemplatesWithOptions(request: ListPipelineTemplatesRequest, runtime: Util.RuntimeOptions): ListPipelineTemplatesResponse {
  Util.validateModel(request);
  return doRequest('ListPipelineTemplates', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function listPipelineTemplates(request: ListPipelineTemplatesRequest): ListPipelineTemplatesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPipelineTemplatesWithOptions(request, runtime);
}

model ListPublishVersionsRequest = {
  appKey?: string(name='AppKey'),
}

model ListPublishVersionsResponse = {
  requestId: string(name='RequestId'),
  items: [ string ] (name='Items'),
}

async function listPublishVersionsWithOptions(request: ListPublishVersionsRequest, runtime: Util.RuntimeOptions): ListPublishVersionsResponse {
  Util.validateModel(request);
  return doRequest('ListPublishVersions', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function listPublishVersions(request: ListPublishVersionsRequest): ListPublishVersionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPublishVersionsWithOptions(request, runtime);
}

model ModifyPipelineDefinitionInfoRequest = {
  bid: string(name='Bid'),
  name?: string(name='Name'),
  description?: string(name='Description'),
}

model ModifyPipelineDefinitionInfoResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function modifyPipelineDefinitionInfoWithOptions(request: ModifyPipelineDefinitionInfoRequest, runtime: Util.RuntimeOptions): ModifyPipelineDefinitionInfoResponse {
  Util.validateModel(request);
  return doRequest('ModifyPipelineDefinitionInfo', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function modifyPipelineDefinitionInfo(request: ModifyPipelineDefinitionInfoRequest): ModifyPipelineDefinitionInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPipelineDefinitionInfoWithOptions(request, runtime);
}

model GetPipelineInstanceDataRequest = {
  appKey?: string(name='AppKey'),
  startTime?: string(name='StartTime'),
  endTime?: string(name='EndTime'),
}

model GetPipelineInstanceDataResponse = {
  requestId: string(name='RequestId'),
  successCount: long(name='SuccessCount'),
  totalCount: long(name='TotalCount'),
}

async function getPipelineInstanceDataWithOptions(request: GetPipelineInstanceDataRequest, runtime: Util.RuntimeOptions): GetPipelineInstanceDataResponse {
  Util.validateModel(request);
  return doRequest('GetPipelineInstanceData', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function getPipelineInstanceData(request: GetPipelineInstanceDataRequest): GetPipelineInstanceDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return getPipelineInstanceDataWithOptions(request, runtime);
}

model DescribePluginDetailRequest = {
  pluginName: string(name='PluginName'),
  pluginVersion?: string(name='PluginVersion'),
}

model DescribePluginDetailResponse = {
  requestId: string(name='RequestId'),
  result: string(name='Result'),
}

async function describePluginDetailWithOptions(request: DescribePluginDetailRequest, runtime: Util.RuntimeOptions): DescribePluginDetailResponse {
  Util.validateModel(request);
  return doRequest('DescribePluginDetail', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function describePluginDetail(request: DescribePluginDetailRequest): DescribePluginDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return describePluginDetailWithOptions(request, runtime);
}

model DescribePipelineDetailRequest = {
  pipelineInstanceId: string(name='PipelineInstanceId'),
  showArtifact: boolean(name='ShowArtifact'),
  showDslJson?: boolean(name='ShowDslJson'),
  pipelineDefinitionId?: string(name='PipelineDefinitionId'),
}

model DescribePipelineDetailResponse = {
  requestId: string(name='RequestId'),
  currentExecJobs: integer(name='CurrentExecJobs'),
  pipelineInstanceId: string(name='PipelineInstanceId'),
  status: string(name='Status'),
  dslJson: string(name='DslJson'),
  operator: string(name='Operator'),
  startTime: long(name='StartTime'),
  endTime: long(name='EndTime'),
  pipelineDefinitionName: string(name='PipelineDefinitionName'),
  pipelineArtifacts: [
    {
      fileKey: string(name='FileKey'),
      fileName: string(name='FileName'),
      fileType: string(name='FileType'),
      fileUrl: string(name='FileUrl'),
      storageType: string(name='StorageType'),
      artifactType: string(name='ArtifactType'),
      isPublic: boolean(name='IsPublic'),
      size: long(name='Size'),
      md5: string(name='Md5'),
      jobInstanceId: string(name='JobInstanceId'),
      createTime: long(name='CreateTime'),
      updateTime: long(name='UpdateTime'),
      ext: string(name='Ext'),
    }
  ](name='PipelineArtifacts'),
  jobDetails: [
    {
      name: string(name='Name'),
      bid: string(name='Bid'),
      jobKey: string(name='JobKey'),
      pipelineInstanceId: string(name='PipelineInstanceId'),
      status: string(name='Status'),
      startTime: long(name='StartTime'),
      endTime: long(name='EndTime'),
      gmtCreate: long(name='GmtCreate'),
      gmtModified: long(name='GmtModified'),
      jobInstanceId: string(name='JobInstanceId'),
      createTime: long(name='CreateTime'),
      updateTime: long(name='UpdateTime'),
      currentExecSteps: integer(name='CurrentExecSteps'),
      steps: integer(name='Steps'),
      currentStepBid: string(name='CurrentStepBid'),
      artifacts: [
        {
          fileKey: string(name='FileKey'),
          fileName: string(name='FileName'),
          fileType: string(name='FileType'),
          fileUrl: string(name='FileUrl'),
          storageType: string(name='StorageType'),
          artifactType: string(name='ArtifactType'),
          isPublic: boolean(name='IsPublic'),
          size: long(name='Size'),
          md5: string(name='Md5'),
          jobInstanceId: string(name='JobInstanceId'),
          createTime: long(name='CreateTime'),
          updateTime: long(name='UpdateTime'),
          ext: string(name='Ext'),
        }
      ](name='Artifacts'),
    }
  ](name='JobDetails'),
}

async function describePipelineDetailWithOptions(request: DescribePipelineDetailRequest, runtime: Util.RuntimeOptions): DescribePipelineDetailResponse {
  Util.validateModel(request);
  return doRequest('DescribePipelineDetail', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function describePipelineDetail(request: DescribePipelineDetailRequest): DescribePipelineDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return describePipelineDetailWithOptions(request, runtime);
}

model InitAppPipelineRequest = {
  appKey: string(name='AppKey'),
  appPlatform: integer(name='AppPlatform'),
  envVariables?: string(name='EnvVariables'),
}

model InitAppPipelineResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function initAppPipelineWithOptions(request: InitAppPipelineRequest, runtime: Util.RuntimeOptions): InitAppPipelineResponse {
  Util.validateModel(request);
  return doRequest('InitAppPipeline', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function initAppPipeline(request: InitAppPipelineRequest): InitAppPipelineResponse {
  var runtime = new Util.RuntimeOptions{};
  return initAppPipelineWithOptions(request, runtime);
}

model CancelPipelineRequest = {
  pipelineInstanceId: string(name='PipelineInstanceId'),
}

model CancelPipelineResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function cancelPipelineWithOptions(request: CancelPipelineRequest, runtime: Util.RuntimeOptions): CancelPipelineResponse {
  Util.validateModel(request);
  return doRequest('CancelPipeline', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function cancelPipeline(request: CancelPipelineRequest): CancelPipelineResponse {
  var runtime = new Util.RuntimeOptions{};
  return cancelPipelineWithOptions(request, runtime);
}

model QueryArtifactSignatureRequest = {
  artifactMd5: string(name='ArtifactMd5'),
  expireTime: long(name='ExpireTime'),
  jobInstanceId?: string(name='JobInstanceId'),
}

model QueryArtifactSignatureResponse = {
  requestId: string(name='RequestId'),
  result: string(name='Result'),
}

async function queryArtifactSignatureWithOptions(request: QueryArtifactSignatureRequest, runtime: Util.RuntimeOptions): QueryArtifactSignatureResponse {
  Util.validateModel(request);
  return doRequest('QueryArtifactSignature', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function queryArtifactSignature(request: QueryArtifactSignatureRequest): QueryArtifactSignatureResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryArtifactSignatureWithOptions(request, runtime);
}

model CreatePublishPlanWithPipelineRequest = {
  appKey: string(name='AppKey'),
  appPlatform: integer(name='AppPlatform'),
  appVersion: string(name='AppVersion'),
  versionCode?: integer(name='VersionCode'),
  planName?: string(name='PlanName'),
}

model CreatePublishPlanWithPipelineResponse = {
  requestId: string(name='RequestId'),
  publishPlanBid: string(name='PublishPlanBid'),
  pipelineId: string(name='PipelineId'),
}

async function createPublishPlanWithPipelineWithOptions(request: CreatePublishPlanWithPipelineRequest, runtime: Util.RuntimeOptions): CreatePublishPlanWithPipelineResponse {
  Util.validateModel(request);
  return doRequest('CreatePublishPlanWithPipeline', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function createPublishPlanWithPipeline(request: CreatePublishPlanWithPipelineRequest): CreatePublishPlanWithPipelineResponse {
  var runtime = new Util.RuntimeOptions{};
  return createPublishPlanWithPipelineWithOptions(request, runtime);
}

model CreatePipelinePublishBatchRequest = {
  appKey: string(name='AppKey'),
  appPlatform: integer(name='AppPlatform'),
  pipelineInstanceId?: string(name='PipelineInstanceId'),
  batchType: string(name='BatchType'),
  publishStrategy: map[string]any(name='PublishStrategy'),
  planBid: string(name='PlanBid'),
}

model CreatePipelinePublishBatchShrinkRequest = {
  appKey: string(name='AppKey'),
  appPlatform: integer(name='AppPlatform'),
  pipelineInstanceId?: string(name='PipelineInstanceId'),
  batchType: string(name='BatchType'),
  publishStrategyShrink: string(name='PublishStrategy'),
  planBid: string(name='PlanBid'),
}

model CreatePipelinePublishBatchResponse = {
  requestId: string(name='RequestId'),
  result: string(name='Result'),
}

async function createPipelinePublishBatchWithOptions(tmp: CreatePipelinePublishBatchRequest, runtime: Util.RuntimeOptions): CreatePipelinePublishBatchResponse {
  Util.validateModel(tmp);
  var request = new CreatePipelinePublishBatchShrinkRequest{};
  RPCUtil.convert(tmp, request);
  if (!Util.isUnset(tmp.publishStrategy)) {
    request.publishStrategyShrink = Util.toJSONString(tmp.publishStrategy);
  }

  return doRequest('CreatePipelinePublishBatch', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function createPipelinePublishBatch(request: CreatePipelinePublishBatchRequest): CreatePipelinePublishBatchResponse {
  var runtime = new Util.RuntimeOptions{};
  return createPipelinePublishBatchWithOptions(request, runtime);
}

model ModifyPublishPipelineTemplateRequest = {
  appKey: string(name='AppKey'),
  appPlatform: integer(name='AppPlatform'),
  androidCertId?: string(name='AndroidCertId'),
  iosCertId?: string(name='IosCertId'),
  iosMobileProvisions?: string(name='IosMobileProvisions'),
  envVariables?: string(name='EnvVariables'),
  taskParams?: string(name='TaskParams'),
}

model ModifyPublishPipelineTemplateResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function modifyPublishPipelineTemplateWithOptions(request: ModifyPublishPipelineTemplateRequest, runtime: Util.RuntimeOptions): ModifyPublishPipelineTemplateResponse {
  Util.validateModel(request);
  return doRequest('ModifyPublishPipelineTemplate', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function modifyPublishPipelineTemplate(request: ModifyPublishPipelineTemplateRequest): ModifyPublishPipelineTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPublishPipelineTemplateWithOptions(request, runtime);
}

model FinishPublishPlanRequest = {
  appKey: string(name='AppKey'),
  planBid: string(name='PlanBid'),
}

model FinishPublishPlanResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function finishPublishPlanWithOptions(request: FinishPublishPlanRequest, runtime: Util.RuntimeOptions): FinishPublishPlanResponse {
  Util.validateModel(request);
  return doRequest('FinishPublishPlan', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function finishPublishPlan(request: FinishPublishPlanRequest): FinishPublishPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return finishPublishPlanWithOptions(request, runtime);
}

model ListCertConfigsRequest = {
  appKey: string(name='AppKey'),
  appPlatform: integer(name='AppPlatform'),
}

model ListCertConfigsResponse = {
  requestId: string(name='RequestId'),
  iosCertList: [
    {
      bid: string(name='Bid'),
      serialNumber: string(name='SerialNumber'),
      fileName: string(name='FileName'),
      commonName: string(name='CommonName'),
      organization: string(name='Organization'),
      status: integer(name='Status'),
      expireDate: long(name='ExpireDate'),
      createTime: long(name='CreateTime'),
      updateTime: long(name='UpdateTime'),
      mobileProvisionQueryVOList: [
        {
          bid: string(name='Bid'),
          certBid: string(name='CertBid'),
          fileName: string(name='FileName'),
          uuid: string(name='Uuid'),
          status: integer(name='Status'),
          expireDate: long(name='ExpireDate'),
          createTime: long(name='CreateTime'),
          updateTime: long(name='UpdateTime'),
          creatorAccount: {
            uid: string(name='Uid'),
            username: string(name='Username'),
            displayName: string(name='DisplayName'),
            email: string(name='Email'),
          }(name='CreatorAccount'),
        }
      ](name='MobileProvisionQueryVOList'),
      creatorAccount: {
        uid: string(name='Uid'),
        username: string(name='Username'),
        displayName: string(name='DisplayName'),
        email: string(name='Email'),
      }(name='CreatorAccount'),
    }
  ](name='IosCertList'),
  androidCertList: [
    {
      bid: string(name='Bid'),
      fileName: string(name='FileName'),
      serialNumber: string(name='SerialNumber'),
      status: integer(name='Status'),
      keyAlias: string(name='KeyAlias'),
      expireDate: long(name='ExpireDate'),
      createTime: long(name='CreateTime'),
      updateTime: long(name='UpdateTime'),
      creatorAccount: {
        uid: string(name='Uid'),
        username: string(name='Username'),
        displayName: string(name='DisplayName'),
        email: string(name='Email'),
      }(name='CreatorAccount'),
    }
  ](name='AndroidCertList'),
}

async function listCertConfigsWithOptions(request: ListCertConfigsRequest, runtime: Util.RuntimeOptions): ListCertConfigsResponse {
  Util.validateModel(request);
  return doRequest('ListCertConfigs', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function listCertConfigs(request: ListCertConfigsRequest): ListCertConfigsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCertConfigsWithOptions(request, runtime);
}

model GetScmRsaPubKeyRequest = {
}

model GetScmRsaPubKeyResponse = {
  requestId: string(name='RequestId'),
  identifier: string(name='Identifier'),
  rsaPub: string(name='RsaPub'),
}

async function getScmRsaPubKeyWithOptions(request: GetScmRsaPubKeyRequest, runtime: Util.RuntimeOptions): GetScmRsaPubKeyResponse {
  Util.validateModel(request);
  return doRequest('GetScmRsaPubKey', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function getScmRsaPubKey(request: GetScmRsaPubKeyRequest): GetScmRsaPubKeyResponse {
  var runtime = new Util.RuntimeOptions{};
  return getScmRsaPubKeyWithOptions(request, runtime);
}

model ListPublishBatchesRequest = {
  appKey: string(name='AppKey'),
  planBid: string(name='PlanBid'),
  batchType?: string(name='BatchType'),
  appPlatform: integer(name='AppPlatform'),
}

model ListPublishBatchesResponse = {
  requestId: string(name='RequestId'),
  items: [
    {
      batchBid: string(name='BatchBid'),
      planBid: string(name='PlanBid'),
      batchStatus: string(name='BatchStatus'),
      batchType: string(name='BatchType'),
      notifiedCount: long(name='NotifiedCount'),
      updatedCount: long(name='UpdatedCount'),
      finishTime: long(name='FinishTime'),
      plannedNotifyCount: integer(name='PlannedNotifyCount'),
      plannedUpdateCount: integer(name='PlannedUpdateCount'),
      startTime: long(name='StartTime'),
      endTime: long(name='EndTime'),
      updateRemindType: string(name='UpdateRemindType'),
      creatorAccount: {
        uid: string(name='Uid'),
        username: string(name='Username'),
        displayName: string(name='DisplayName'),
        email: string(name='Email'),
      }(name='CreatorAccount'),
    }
  ](name='Items'),
}

async function listPublishBatchesWithOptions(request: ListPublishBatchesRequest, runtime: Util.RuntimeOptions): ListPublishBatchesResponse {
  Util.validateModel(request);
  return doRequest('ListPublishBatches', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function listPublishBatches(request: ListPublishBatchesRequest): ListPublishBatchesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPublishBatchesWithOptions(request, runtime);
}

model UpdateIosCertRequest = {
  bid: string(name='Bid'),
  appKey: string(name='AppKey'),
  fileName?: string(name='FileName'),
  certificate?: string(name='Certificate'),
  credential?: string(name='Credential'),
  mobileProvisionList?: map[string]any(name='MobileProvisionList'),
}

model UpdateIosCertShrinkRequest = {
  bid: string(name='Bid'),
  appKey: string(name='AppKey'),
  fileName?: string(name='FileName'),
  certificate?: string(name='Certificate'),
  credential?: string(name='Credential'),
  mobileProvisionListShrink?: string(name='MobileProvisionList'),
}

model UpdateIosCertResponse = {
  requestId: string(name='RequestId'),
  bid: string(name='Bid'),
  serialNumber: string(name='SerialNumber'),
  fileName: string(name='FileName'),
  commonName: string(name='CommonName'),
  organization: string(name='Organization'),
  status: integer(name='Status'),
  expireDate: long(name='ExpireDate'),
  createTime: long(name='CreateTime'),
  updateTime: long(name='UpdateTime'),
  mobileProvisionQueryVOList: [
    {
      bid: string(name='Bid'),
      certBid: string(name='CertBid'),
      fileName: string(name='FileName'),
      uuid: string(name='Uuid'),
      status: integer(name='Status'),
      expireDate: long(name='ExpireDate'),
      createTime: long(name='CreateTime'),
      updateTime: long(name='UpdateTime'),
    }
  ](name='MobileProvisionQueryVOList'),
}

async function updateIosCertWithOptions(tmp: UpdateIosCertRequest, runtime: Util.RuntimeOptions): UpdateIosCertResponse {
  Util.validateModel(tmp);
  var request = new UpdateIosCertShrinkRequest{};
  RPCUtil.convert(tmp, request);
  if (!Util.isUnset(tmp.mobileProvisionList)) {
    request.mobileProvisionListShrink = Util.toJSONString(tmp.mobileProvisionList);
  }

  return doRequest('UpdateIosCert', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function updateIosCert(request: UpdateIosCertRequest): UpdateIosCertResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateIosCertWithOptions(request, runtime);
}

model TerminateBatchRequest = {
  appKey: string(name='AppKey'),
  batchBid: string(name='BatchBid'),
  appPlatform?: integer(name='AppPlatform'),
  batchType: string(name='BatchType'),
  sprintBid?: string(name='SprintBid'),
}

model TerminateBatchResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function terminateBatchWithOptions(request: TerminateBatchRequest, runtime: Util.RuntimeOptions): TerminateBatchResponse {
  Util.validateModel(request);
  return doRequest('TerminateBatch', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function terminateBatch(request: TerminateBatchRequest): TerminateBatchResponse {
  var runtime = new Util.RuntimeOptions{};
  return terminateBatchWithOptions(request, runtime);
}

model CreateIosCertRequest = {
  appKey: string(name='AppKey'),
  fileName: string(name='FileName'),
  certificate: string(name='Certificate'),
  credential: string(name='Credential'),
  mobileProvisionList: string(name='MobileProvisionList'),
}

model CreateIosCertResponse = {
  requestId: string(name='RequestId'),
  bid: string(name='Bid'),
  serialNumber: string(name='SerialNumber'),
  fileName: string(name='FileName'),
  commonName: string(name='CommonName'),
  organization: string(name='Organization'),
  status: integer(name='Status'),
  expireDate: long(name='ExpireDate'),
  createTime: long(name='CreateTime'),
  updateTime: long(name='UpdateTime'),
  mobileProvisionQueryVOList: [
    {
      bid: string(name='Bid'),
      certBid: string(name='CertBid'),
      fileName: string(name='FileName'),
      uuid: string(name='Uuid'),
      status: integer(name='Status'),
      expireDate: long(name='ExpireDate'),
      createTime: long(name='CreateTime'),
      updateTime: long(name='UpdateTime'),
    }
  ](name='MobileProvisionQueryVOList'),
}

async function createIosCertWithOptions(request: CreateIosCertRequest, runtime: Util.RuntimeOptions): CreateIosCertResponse {
  Util.validateModel(request);
  return doRequest('CreateIosCert', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function createIosCert(request: CreateIosCertRequest): CreateIosCertResponse {
  var runtime = new Util.RuntimeOptions{};
  return createIosCertWithOptions(request, runtime);
}

model DeleteAndroidCertRequest = {
  appKey: string(name='AppKey'),
  bid: string(name='Bid'),
}

model DeleteAndroidCertResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function deleteAndroidCertWithOptions(request: DeleteAndroidCertRequest, runtime: Util.RuntimeOptions): DeleteAndroidCertResponse {
  Util.validateModel(request);
  return doRequest('DeleteAndroidCert', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function deleteAndroidCert(request: DeleteAndroidCertRequest): DeleteAndroidCertResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteAndroidCertWithOptions(request, runtime);
}

model CreateAndroidCertRequest = {
  appKey: string(name='AppKey'),
  fileName: string(name='FileName'),
  certificate: string(name='Certificate'),
  credential: string(name='Credential'),
  keyAlias: string(name='KeyAlias'),
  keyPassword: string(name='KeyPassword'),
}

model CreateAndroidCertResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function createAndroidCertWithOptions(request: CreateAndroidCertRequest, runtime: Util.RuntimeOptions): CreateAndroidCertResponse {
  Util.validateModel(request);
  return doRequest('CreateAndroidCert', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function createAndroidCert(request: CreateAndroidCertRequest): CreateAndroidCertResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAndroidCertWithOptions(request, runtime);
}

model DeleteIosCertRequest = {
  appKey: string(name='AppKey'),
  bid: string(name='Bid'),
}

model DeleteIosCertResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function deleteIosCertWithOptions(request: DeleteIosCertRequest, runtime: Util.RuntimeOptions): DeleteIosCertResponse {
  Util.validateModel(request);
  return doRequest('DeleteIosCert', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function deleteIosCert(request: DeleteIosCertRequest): DeleteIosCertResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteIosCertWithOptions(request, runtime);
}

model GetPublishBatchDetailRequest = {
  appKey: string(name='AppKey'),
  batchBid: string(name='BatchBid'),
  appPlatform: integer(name='AppPlatform'),
}

model GetPublishBatchDetailResponse = {
  requestId: string(name='RequestId'),
  batchBid: string(name='BatchBid'),
  planBid: string(name='PlanBid'),
  batchStatus: string(name='BatchStatus'),
  batchType: string(name='BatchType'),
  createTime: long(name='CreateTime'),
  updateTime: long(name='UpdateTime'),
  updateRemindType: string(name='UpdateRemindType'),
  finishTime: long(name='FinishTime'),
  notifiedCount: long(name='NotifiedCount'),
  updatedCount: long(name='UpdatedCount'),
  strategiesVO: {
    largerThanThisApiLevel: integer(name='LargerThanThisApiLevel'),
    updateVersions: string(name='UpdateVersions'),
    remindCount: integer(name='RemindCount'),
    plannedNotifyCount: integer(name='PlannedNotifyCount'),
    updateRemindType: string(name='UpdateRemindType'),
    startTime: long(name='StartTime'),
    endTime: long(name='EndTime'),
    remindText: string(name='RemindText'),
    whiteDevicesDownLoadUrl: string(name='WhiteDevicesDownLoadUrl'),
    osVersions: [ string ](name='OsVersions'),
    brands: [ string ](name='Brands'),
    models: [ string ](name='Models'),
    excludeBrands: [ string ](name='ExcludeBrands'),
    excludeModels: [ string ](name='ExcludeModels'),
  }(name='StrategiesVO'),
  creatorAccount: {
    uid: string(name='Uid'),
    username: string(name='Username'),
    displayName: string(name='DisplayName'),
    email: string(name='Email'),
  }(name='CreatorAccount'),
  modifierAccount: {
    uid: string(name='Uid'),
    username: string(name='Username'),
    displayName: string(name='DisplayName'),
    email: string(name='Email'),
  }(name='ModifierAccount'),
}

async function getPublishBatchDetailWithOptions(request: GetPublishBatchDetailRequest, runtime: Util.RuntimeOptions): GetPublishBatchDetailResponse {
  Util.validateModel(request);
  return doRequest('GetPublishBatchDetail', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function getPublishBatchDetail(request: GetPublishBatchDetailRequest): GetPublishBatchDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return getPublishBatchDetailWithOptions(request, runtime);
}

model DescribeSprintPublishDataRequest = {
  appKey: string(name='AppKey'),
  sprintBid: string(name='SprintBid'),
}

model DescribeSprintPublishDataResponse = {
  requestId: string(name='RequestId'),
  sprintBid: string(name='SprintBid'),
  planBid: string(name='PlanBid'),
  appKey: string(name='AppKey'),
  appPlatform: integer(name='AppPlatform'),
  version: string(name='Version'),
  updateData: {
    notifiedCount: long(name='NotifiedCount'),
    updatedCount: long(name='UpdatedCount'),
  }(name='UpdateData'),
}

async function describeSprintPublishDataWithOptions(request: DescribeSprintPublishDataRequest, runtime: Util.RuntimeOptions): DescribeSprintPublishDataResponse {
  Util.validateModel(request);
  return doRequest('DescribeSprintPublishData', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function describeSprintPublishData(request: DescribeSprintPublishDataRequest): DescribeSprintPublishDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSprintPublishDataWithOptions(request, runtime);
}

model ListScmConfigsRequest = {
}

model ListScmConfigsResponse = {
  requestId: string(name='RequestId'),
  items: [
    {
      bid: string(name='Bid'),
      repoDomain: string(name='RepoDomain'),
      protocolType: string(name='ProtocolType'),
      repoType: string(name='RepoType'),
      userName: string(name='UserName'),
      token: string(name='Token'),
      rsaPub: string(name='RsaPub'),
      createTime: long(name='CreateTime'),
      updateTime: long(name='UpdateTime'),
      creatorAccount: {
        uid: string(name='Uid'),
        username: string(name='Username'),
        displayName: string(name='DisplayName'),
        email: string(name='Email'),
      }(name='CreatorAccount'),
      modifierAccount: {
        uid: string(name='Uid'),
        username: string(name='Username'),
        displayName: string(name='DisplayName'),
        email: string(name='Email'),
      }(name='ModifierAccount'),
    }
  ](name='Items'),
}

async function listScmConfigsWithOptions(request: ListScmConfigsRequest, runtime: Util.RuntimeOptions): ListScmConfigsResponse {
  Util.validateModel(request);
  return doRequest('ListScmConfigs', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function listScmConfigs(request: ListScmConfigsRequest): ListScmConfigsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listScmConfigsWithOptions(request, runtime);
}

model GetScmAppConfigRequest = {
  appKey: string(name='AppKey'),
}

model GetScmAppConfigResponse = {
  requestId: string(name='RequestId'),
  bid: string(name='Bid'),
  scmAddr: string(name='ScmAddr'),
  currentAccessIdentifier: map[string]any(name='CurrentAccessIdentifier'),
  scmAccessIdentifiers: map[string]any(name='ScmAccessIdentifiers'),
  branch: string(name='Branch'),
}

async function getScmAppConfigWithOptions(request: GetScmAppConfigRequest, runtime: Util.RuntimeOptions): GetScmAppConfigResponse {
  Util.validateModel(request);
  return doRequest('GetScmAppConfig', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function getScmAppConfig(request: GetScmAppConfigRequest): GetScmAppConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return getScmAppConfigWithOptions(request, runtime);
}

model DeleteScmConfigRequest = {
  bid: string(name='Bid'),
  appKey: string(name='AppKey'),
}

model DeleteScmConfigResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function deleteScmConfigWithOptions(request: DeleteScmConfigRequest, runtime: Util.RuntimeOptions): DeleteScmConfigResponse {
  Util.validateModel(request);
  return doRequest('DeleteScmConfig', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function deleteScmConfig(request: DeleteScmConfigRequest): DeleteScmConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteScmConfigWithOptions(request, runtime);
}

model GetPublishFileRequest = {
  appKey: string(name='AppKey'),
  planBid: string(name='PlanBid'),
}

model GetPublishFileResponse = {
  requestId: string(name='RequestId'),
  buildTaskBid: string(name='BuildTaskBid'),
  fileName: string(name='FileName'),
  cdnUrl: map[string]any(name='CdnUrl'),
}

async function getPublishFileWithOptions(request: GetPublishFileRequest, runtime: Util.RuntimeOptions): GetPublishFileResponse {
  Util.validateModel(request);
  return doRequest('GetPublishFile', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function getPublishFile(request: GetPublishFileRequest): GetPublishFileResponse {
  var runtime = new Util.RuntimeOptions{};
  return getPublishFileWithOptions(request, runtime);
}

model CreateScmConfigRequest = {
  repoType: string(name='RepoType'),
  protocolType: string(name='ProtocolType'),
  repoDomain: string(name='RepoDomain'),
  userName: string(name='UserName'),
  token?: string(name='Token'),
  identifier?: string(name='Identifier'),
  appKey: string(name='AppKey'),
}

model CreateScmConfigResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function createScmConfigWithOptions(request: CreateScmConfigRequest, runtime: Util.RuntimeOptions): CreateScmConfigResponse {
  Util.validateModel(request);
  return doRequest('CreateScmConfig', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function createScmConfig(request: CreateScmConfigRequest): CreateScmConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return createScmConfigWithOptions(request, runtime);
}

model CheckScmAppConnectivityRequest = {
  appKey: string(name='AppKey'),
  scmAddr: string(name='ScmAddr'),
  scmAccessBid: string(name='ScmAccessBid'),
  branch: string(name='Branch'),
  appPlatform: integer(name='AppPlatform'),
}

model CheckScmAppConnectivityResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function checkScmAppConnectivityWithOptions(request: CheckScmAppConnectivityRequest, runtime: Util.RuntimeOptions): CheckScmAppConnectivityResponse {
  Util.validateModel(request);
  return doRequest('CheckScmAppConnectivity', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function checkScmAppConnectivity(request: CheckScmAppConnectivityRequest): CheckScmAppConnectivityResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkScmAppConnectivityWithOptions(request, runtime);
}

model UpdateScmConfigRequest = {
  bid: string(name='Bid'),
  repoType: string(name='RepoType'),
  protocolType: string(name='ProtocolType'),
  repoDomain: string(name='RepoDomain'),
  userName: string(name='UserName'),
  token?: string(name='Token'),
  identifier?: string(name='Identifier'),
  appKey: string(name='AppKey'),
}

model UpdateScmConfigResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function updateScmConfigWithOptions(request: UpdateScmConfigRequest, runtime: Util.RuntimeOptions): UpdateScmConfigResponse {
  Util.validateModel(request);
  return doRequest('UpdateScmConfig', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function updateScmConfig(request: UpdateScmConfigRequest): UpdateScmConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateScmConfigWithOptions(request, runtime);
}

model CreateScmAppConfigRequest = {
  appKey: string(name='AppKey'),
  scmAddr: string(name='ScmAddr'),
  scmAccessBid: string(name='ScmAccessBid'),
  branch: string(name='Branch'),
  appPlatform: integer(name='AppPlatform'),
  contextUserUpdateRequest?: map[string]any(name='ContextUserUpdateRequest'),
}

model CreateScmAppConfigShrinkRequest = {
  appKey: string(name='AppKey'),
  scmAddr: string(name='ScmAddr'),
  scmAccessBid: string(name='ScmAccessBid'),
  branch: string(name='Branch'),
  appPlatform: integer(name='AppPlatform'),
  contextUserUpdateRequestShrink?: string(name='ContextUserUpdateRequest'),
}

model CreateScmAppConfigResponse = {
  requestId: string(name='RequestId'),
  bid: string(name='Bid'),
  scmAddr: string(name='ScmAddr'),
  currentAccessIdentifier: map[string]any(name='CurrentAccessIdentifier'),
  scmAccessIdentifiers: map[string]any(name='ScmAccessIdentifiers'),
  branch: string(name='Branch'),
}

async function createScmAppConfigWithOptions(tmp: CreateScmAppConfigRequest, runtime: Util.RuntimeOptions): CreateScmAppConfigResponse {
  Util.validateModel(tmp);
  var request = new CreateScmAppConfigShrinkRequest{};
  RPCUtil.convert(tmp, request);
  if (!Util.isUnset(tmp.contextUserUpdateRequest)) {
    request.contextUserUpdateRequestShrink = Util.toJSONString(tmp.contextUserUpdateRequest);
  }

  return doRequest('CreateScmAppConfig', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function createScmAppConfig(request: CreateScmAppConfigRequest): CreateScmAppConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return createScmAppConfigWithOptions(request, runtime);
}

model UpdateScmAppConfigRequest = {
  bid: string(name='Bid'),
  appKey: string(name='AppKey'),
  scmAddr: string(name='ScmAddr'),
  scmAccessBid: string(name='ScmAccessBid'),
  branch: string(name='Branch'),
  appPlatform: integer(name='AppPlatform'),
  contextUserUpdateRequest?: map[string]any(name='ContextUserUpdateRequest'),
}

model UpdateScmAppConfigShrinkRequest = {
  bid: string(name='Bid'),
  appKey: string(name='AppKey'),
  scmAddr: string(name='ScmAddr'),
  scmAccessBid: string(name='ScmAccessBid'),
  branch: string(name='Branch'),
  appPlatform: integer(name='AppPlatform'),
  contextUserUpdateRequestShrink?: string(name='ContextUserUpdateRequest'),
}

model UpdateScmAppConfigResponse = {
  requestId: string(name='RequestId'),
  bid: string(name='Bid'),
  scmAddr: string(name='ScmAddr'),
  currentAccessIdentifier: map[string]any(name='CurrentAccessIdentifier'),
  scmAccessIdentifiers: map[string]any(name='ScmAccessIdentifiers'),
  branch: string(name='Branch'),
}

async function updateScmAppConfigWithOptions(tmp: UpdateScmAppConfigRequest, runtime: Util.RuntimeOptions): UpdateScmAppConfigResponse {
  Util.validateModel(tmp);
  var request = new UpdateScmAppConfigShrinkRequest{};
  RPCUtil.convert(tmp, request);
  if (!Util.isUnset(tmp.contextUserUpdateRequest)) {
    request.contextUserUpdateRequestShrink = Util.toJSONString(tmp.contextUserUpdateRequest);
  }

  return doRequest('UpdateScmAppConfig', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function updateScmAppConfig(request: UpdateScmAppConfigRequest): UpdateScmAppConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateScmAppConfigWithOptions(request, runtime);
}

model CreatePublishBatchRequest = {
  appKey: string(name='AppKey'),
  appPlatform: integer(name='AppPlatform'),
  planBid: string(name='PlanBid'),
  batchType: string(name='BatchType'),
  publishStrategy: map[string]any(name='PublishStrategy'),
}

model CreatePublishBatchShrinkRequest = {
  appKey: string(name='AppKey'),
  appPlatform: integer(name='AppPlatform'),
  planBid: string(name='PlanBid'),
  batchType: string(name='BatchType'),
  publishStrategyShrink: string(name='PublishStrategy'),
}

model CreatePublishBatchResponse = {
  requestId: string(name='RequestId'),
  result: boolean(name='Result'),
}

async function createPublishBatchWithOptions(tmp: CreatePublishBatchRequest, runtime: Util.RuntimeOptions): CreatePublishBatchResponse {
  Util.validateModel(tmp);
  var request = new CreatePublishBatchShrinkRequest{};
  RPCUtil.convert(tmp, request);
  if (!Util.isUnset(tmp.publishStrategy)) {
    request.publishStrategyShrink = Util.toJSONString(tmp.publishStrategy);
  }

  return doRequest('CreatePublishBatch', 'HTTPS', 'POST', '2019-12-04', 'AK', null, request, runtime);
}

async function createPublishBatch(request: CreatePublishBatchRequest): CreatePublishBatchResponse {
  var runtime = new Util.RuntimeOptions{};
  return createPublishBatchWithOptions(request, runtime);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }

  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
